<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>企业主页</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no,email=no" />
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/homePage.css" />
		
		
	</head>
	<body> 
		
		
		<script src="../js/mui.min.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript" charset="utf-8">
			 //mui初始化
			mui.init();
			
			  
			
		</script>
		<div class="mui-content">
			<!--轮播图-->
			<div id="slider" class="mui-slider  ">
				<div class="mui-slider-group mui-slider-loop" id="sliderImg">
				</div>
				<div class="mui-slider-indicator">
				</div>
				<!--<div class="mui-pull-loading mui-spinner custom-loading"></div>-->
			</div>
			
			<ul class="mui-table-view mui-grid-view mui-grid-9">
				<li class="mui-table-view-cell mui-media mui-col-xs-3 ">
				    <a href="#">
				        <img src="../images/h03.png" class="mui-grid-img">
				        <div class="mui-media-body">新闻</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3 ">
				    <a href="#">
				         <img src="../images/h03.png" class="mui-grid-img"></span>
				        <div class="mui-media-body">文学</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3 ">
				    <a href="#">
				         <img src="../images/h03.png" class="mui-grid-img">
				        <div class="mui-media-body">购物</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3 ">
				    <a href="#">
				        <img src="../images/h03.png" class="mui-grid-img">
				        <div class="mui-media-body">更多</div>
				    </a>
				</li>
			</ul>
			<!--推荐公司-->
			<ul class="mui-table-view" id="companys">
			    <li class="mui-table-view-cell mui-media">
			        <a href="javascript:;">
			            <img class="mui-media-object mui-pull-left" src="../images/h07.png">
			            <div class="mui-media-body">
			                <strong>幸福啊</strong>
			                <p class="mui-ellipsis">能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</p>
			            </div>
			        </a>
			    </li>
			    <li class="mui-table-view-cell mui-media">
			        <a href="javascript:;">
			            <img class="mui-media-object mui-pull-left" src="../images/h08.png">
			            <div class="mui-media-body">
			                <strong>幸福</strong>
			                <p class="mui-ellipsis">想要这样一间小木屋，夏天挫冰吃瓜，冬天围炉取暖.</p>
			            </div>
			        </a>
			    </li>
			    <li class="mui-table-view-cell mui-media">
			        <a href="javascript:;">
			            <img class="mui-media-object mui-pull-left" src="../images/h09.png">
			            <div class="mui-media-body">
			                <strong>幸福</strong>
			                <p class="mui-ellipsis">烤炉模式的城，到黄昏，如同打翻的调色盘一般.</p>
			            </div>
			        </a>
			    </li>
			</ul>
			<!--热点新闻-->
			<div class="new-hot">
				<h2>热点新闻</h2>
				<ul class="mui-table-view mui-grid-view mui-grid-9" id="newsHot">
					
				</ul>
			</div>
			<!--公司活动-->
			<div class="activity">
				<!--轮播-->
				<div id="slider2" class="mui-slider mui-content ">
					<div class="mui-slider-group mui-slider-loop" id="sliderImg2">
					</div>
					<div class="mui-slider-indicator">
					</div>
					<!--<div class="mui-pull-loading mui-spinner custom-loading"></div>-->
				</div>
				<!--图文列表-->
				<ul class="mui-table-view" id="newsList"> 
				    <li class="mui-table-view-cell mui-media">
				        <a href="javascript:;">
				            <img class="mui-media-object mui-pull-left" src="../images/h07.png">
				            <div class="mui-media-body">
				                <strong>幸福</strong>
				                <p class="mui-ellipsis">能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</p>
				            </div>
				        </a>
				    </li>
				    <li class="mui-table-view-cell mui-media">
				        <a href="javascript:;">
				            <img class="mui-media-object mui-pull-left" src="../images/h08.png">
				            <div class="mui-media-body"> 
				                <strong>幸福</strong>
				                <p class="mui-ellipsis">想要这样一间小木屋，夏天挫冰吃瓜，冬天围炉取暖.</p>
				            </div>
				        </a>
				    </li>
				    <li class="mui-table-view-cell mui-media">
				        <a href="javascript:;">
				            <img class="mui-media-object mui-pull-left" src="../images/h09.png">
				            <div class="mui-media-body">
				                <strong>幸福</strong>
				                <p class="mui-ellipsis">烤炉模式的城，到黄昏，如同打翻的调色盘一般.</p>
				            </div>
				        </a>
				    </li>
				</ul>
			</div>
			<!--圈子-->
			<div class="zone" id="zoneImg">
				<h2>圈子</h2>
				<a>
				<img src="../images/a2.png"/>  
				</a>
				
			</div>
		</div>
	<script type="text/javascript">
		
		var slider=document.getElementById('sliderImg');
		var slider2=document.getElementById('sliderImg2');
		var newsHot=document.getElementById('newsHot');
		var companys=document.getElementById('companys');
		var newsList=document.getElementById('newsList');
		mui.plusReady(function() { 
				loadPage=function(){	 
					mui.ajax('http://122.114.101.135/app/homePage/GetIndex',{
								dataType:'json',
								data:{
									webToken:'rqlh' 
								},
								type:'get',
								timeout:10000,
								success:function(data){									
									//轮播图
									var imgLen=data.Carousel1.length;
									if(imgLen>1){
										
										var outputimg =""; 
							            var outputright = "";   
				 			            
							            outputimg+='<div class="mui-slider-item mui-slider-item-duplicate"><a class="c-href" data-href="'+data.Carousel1[imgLen-1].url+'"><img src="'+data.Carousel1[imgLen-1].src+'" /></a></div>';
							            for (var i = 0; i < imgLen; i++) {
							            	
							            	outputimg+='<div class="mui-slider-item"><a class="c-href" data-href="'+data.Carousel1[i].url+'"><img src="'+data.Carousel1[i].src+'" /></a></div>';
							                outputright += '<div class="mui-indicator'+(i == 0?' mui-active':'')+'"></div>';
							            }
							            
							            outputimg+='<div class="mui-slider-item mui-slider-item-duplicate"><a class="c-href" data-href="'+data.Carousel1[0].url+'"><img src="'+data.Carousel1[0].src+'"  /></a></div>';
							          	
							            slider.innerHTML=outputimg; 
							            
							            document.getElementsByClassName('mui-slider-indicator')[0].innerHTML=outputright;
							             
										mui('#slider').slider({interval:5000});    
										
									}else if(imgLen==1){ 
										slider.innerHTML='<div class="mui-slider-item"><a class="c-href" data-href="'+data.Carousel1[0].url+'"><img src="'+data.Carousel1[0].src+'" style="width:100%" /></a></div>';
										mui('#slider').slider();
										 
									}else{
										document.getElementById('slider').style.display='none';
									}
									//轮播图2 
									var imgLen2=data.Carousel2.length;
									if(imgLen2>1){												
										var outputimg2 = ""; 
							            var outputright2 = "";   
							            
							            outputimg2+='<div class="mui-slider-item mui-slider-item-duplicate"><a class="c-href" data-href="'+data.Carousel2[imgLen2-1].url+'"><img src="'+data.Carousel2[imgLen2-1].src+'" /></a></div>';
							            for (var i = 0; i < imgLen2; i++) {
							            	
							            	outputimg2+='<div class="mui-slider-item"><a class="c-href" data-href="'+data.Carousel2[i].url+'"><img src="'+data.Carousel2[i].src+'" /></a></div>';
							                outputright2 += '<div class="mui-indicator'+(i == 0?' mui-active':'')+'"></div>';
							            }
							           
							            outputimg2+='<div class="mui-slider-item mui-slider-item-duplicate"><a class="c-href" data-href="'+data.Carousel2[0].url+'"><img src="'+data.Carousel2[0].src+'"  /></a></div>';
							            
							            slider2.innerHTML=outputimg2; 
							            
							            document.getElementsByClassName('mui-slider-indicator')[1].innerHTML=outputright;
							            
										mui('#slider2').slider({interval:5000}); 
							            
									}else if(imgLen2==1){
										slider.innerHTML='<div class="mui-slider-item"><a class="c-href" data-href="'+data.Carousel2[0].url+'"><img src="'+data.Carousel2[0].src+'" style="width:100%" /></a></div>';
										mui('#slider2').slider();
										
									}else{
										document.getElementById('slider').style.display='none';
									}
									//推荐公司		 
									var company="";
									
									var comLen=data.Company.length;
									for (var i = 0; i < comLen; i++) {
						            	
						            	company+='<li class="mui-table-view-cell mui-media"><a class="c-href" data-href="./company.html#'+data.Company[i].id+'"><img src="'+data.Company[i].src+'" class="mui-media-object mui-pull-left"><div class="mui-media-body"><strong>'+data.Company[i].name+'</strong><p class="mui-ellipsis">'+data.Company[i].msg+'</p></div></a></li>';
						                
									}
									console.log(company);     
									console.log("haha");
									companys.innerHTML= company ;  
									//热点新闻 
									var hotnews=""; 
									var hotLen=data.HotNews.length;
									for (var i = 0; i < hotLen; i++) {
						            	
						            	hotnews+='<li class="mui-table-view-cell mui-media mui-col-xs-4 "><a class="c-href" data-href="./news.html#'+data.HotNews[i].id+'"><img src="'+data.HotNews[i].src+'" class="mui-new-img"><div class="mui-media-body">'+data.HotNews[i].msg+'</div></a></li>';
						                 
									}
									newsHot.innerHTML=hotnews; 
									//新闻列表
									var news="";
									var newsLen=data.NewsList.length;
									for (var i = 0; i < newsLen; i++) {
						            	
						            	news+='<li class="mui-table-view-cell mui-media"><a class="c-href" data-href="./news.html#'+data.NewsList[i].id+'"><img src="'+data.NewsList[i].src+'" class="mui-media-object mui-pull-left"><div class="mui-media-body"><strong>'+data.NewsList[i].name+'</strong><p class="mui-ellipsis">'+data.NewsList[i].msg+'</p></div></a></li>';
						                
									}
									newsList.innerHTML=news;
									//圈子
//									var zone='<h2>圈子</h2> <a class="c-href" data-href="'+data.zone.url+'"><img src="'+data.zone.src+'"></a>';
//									zoneImg.innerHTML=zone;
								},
								error:function(xhr,type,errorThrown){
									console.log("error");
									   
								}
								     
									  
					}); 
				}
				loadPage();
				/*页面跳转*/
				mui('.mui-content').on('tap', '.c-href', function() {
						console.log("tap");
						var href=this.getAttribute('data-href').toLowerCase(),
							id;
						if(href.indexOf('product/detail/')>=0){
							id=href.split('product/detail/')[1];
							showProduct(id);
						 	
						}else if(href.indexOf('topic/detail/')>=0){
							id=href.split('topic/detail/')[1];
							himall.openVW('topic-detail.html','',{topicId:id});
							
						}else if(href.indexOf('./company')>=0){
							console.log(href);
							id=href.split('./company.html#')[1];
							console.log(id);
							himall.openVW(id,'./company.html#',{companyId:id});
							
						}else if(href.indexOf('./news')>=0){
							console.log(href);
							id=href.split('./news.html#')[1];
							console.log(id);
							himall.openVW(id,'./news.html#',{newsId:id});
							
						} 
						else{
							plus.runtime.openURL(href);
							
						}
				});
				 
		}); 
		
	</script>
	</body>
	
</html>